﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConsoleApp1;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList arr = new ArrayList() { "aa", "bb", "abc", 5228, 4176 };
            int index = arr.IndexOf("abc");
            if (index != -1)
            {
                Console.WriteLine("集合中存在 abc 元素");
            }
            else
            {
                Console.WriteLine("集合没有abc 元素");
            }

            Console.WriteLine();


            ArrayList arr1 = new ArrayList() { 258, 693, 444, 123, 458 };
            ArrayList arr2 = new ArrayList();
            for (int i = 0; i < arr1.Count; i = i + 2)
            {
                arr2.Add(arr1[i]);
            }
            foreach (var a in arr2)
            {
                Console.WriteLine(a);
            }

            Console.WriteLine();


            ArrayList arr3 = new ArrayList() { "你好","呀",124,658};
            ArrayList arr4 = new ArrayList() {"我的","你的","大家的"};
            arr3.InsertRange(1, arr4);
            foreach(var b in arr3)
            {
                Console.WriteLine(b);
            }

            Console.WriteLine();

            ArrayList arr5 = new ArrayList() { 20,50,60,66,70,801,90,40,30,};
            arr5.Sort();
            foreach(var c in arr5)
            {
                Console.WriteLine(c);
            }
            Console.WriteLine();




            ArrayList arr6 = new ArrayList() { "aaa", "bbb", "ccc","ab","bc" };
            MyCompare myCompare = new MyCompare();
            arr6.Sort(myCompare);
            foreach (var item in arr6)
            {
                Console.WriteLine(item);
            }

           

        }
    }
}
